package design.patterns.creational.prototype;

import java.io.Serializable;
import java.util.Date;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/4/1 9:46
 */

// 浅克隆
public class Computer implements  Cloneable,Serializable {
    private String name; //名称
    private Double price; //价格
    private Date  date; //生产日期



    public Computer() {
        System.out.println("构造方法被调用");
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "Computer{" +
                "name='" + name + '\'' +
                ", price=" + price +
                ", date=" + date +
                '}'+super.toString();
    }
}
